package com.example.minzhengtong.ui

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.example.minzhengtong.R
import com.example.minzhengtong.base.BaseA
import com.example.minzhengtong.databinding.ActivityGjjMobileBinding
import com.example.minzhengtong.utils.LogUtil

/**
 * created by WY on 2021/6/19.
 * 手机号码签约
 */
class GJJMobileA : BaseA() {

    companion object{
        fun enterThis(context: Context){
            val intent = Intent(context, GJJMobileA::class.java)
            context.startActivity(intent)
        }
    }

    private lateinit var binding : ActivityGjjMobileBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityGjjMobileBinding.inflate(layoutInflater)
        overridePendingTransition(0,0)
        setContentView(binding.root)
        setToolBarVisiabale(false)
        initImmerBar(true, R.id.title_bar)

        val showAccount = StringBuilder()
        LogUtil.d("展示账户${userBean!!.data!!.uzh!!}")
        showAccount.append(userBean!!.data!!.uzh!!.substring(0,2))
        for (i in userBean!!.data!!.uzh!!.indices-5){
            showAccount.append("*")
        }
        if (showAccount.length > 5){
            LogUtil.d("删除账户星号前$showAccount")
            showAccount.delete(showAccount.length-4,showAccount.length)
            LogUtil.d("删除账户星号后$showAccount")
        }
        showAccount.append("${userBean!!.data!!.uzh!!.substring(userBean!!.data!!.uzh!!.length-3)}")
        if (userBean!!.data!!.uzh!!.length > 5){
            binding.account.text = showAccount
        }else{
            binding.account.text = userBean!!.data!!.uzh!!
//            binding.account.text = "*****"
        }
    }



    override fun finish() {
        super.finish()
        overridePendingTransition(0,0)
    }

}